package com.tianqu.tms.www.transfer.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tianqu.tms.core.base.TmsAction;
import com.tianqu.tms.core.base.UserContext;
import com.tianqu.tms.core.util.TmsConstants;
import com.tianqu.tms.entity.TransferSpecialCarCount;
import com.tianqu.tms.www.transfer.viewhelper.CheckConfirmViewHelper;

public class SpecialCarStatisSearchInputTopAction extends TmsAction {

	@Override
	protected ActionForward doAction(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response,
			UserContext uc) throws Exception {		
		CheckConfirmViewHelper view = (CheckConfirmViewHelper)uc.getAttribute(TmsConstants.VIEWHELP);
		//根据weekId载入列表信息
		TransferSpecialCarCount count = new TransferSpecialCarCount();
		count = count.getTransferSpecialCarCountByWeekId(view.getEndWeekDate());
		//根据weekId查询时间
		TransferSpecialCarCount count1 = new TransferSpecialCarCount();
		count1 = count1.getTransferCountWeekInfo(view.getEndWeekDate());
		
		view.setQuantity1(count.getQuantity1());
		view.setQuantity2(count.getQuantity2());
		view.setQuantity3(count.getQuantity3());
		view.setQuantity4(count.getQuantity4());
		view.setQuantity5(count.getQuantity5());
		
		view.setStartWeekDate(count1.getStartWeekDate());
		view.setEndWeekDate(count1.getEndWeekDate());
		
		request.setAttribute(TmsConstants.VIEWHELP, view);
		return mapping.findForward(TmsConstants.SUCCESS);
	}
}
